STEP 4: Tim will reply to the user with one of four answers. We'll use a random number to pick which answer.

Remember, random.randint() takes two number arguments and generates a random number between them.

  • In the LOGIC tab, click and drag out Random Integer.
  • Also from drag out Variable Display. Drop it at the bottom of your program.
  • Run the code more than once. The display shows a different random number between 1 and 10 each time!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)